using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Windows.Forms;
using System.Drawing;

namespace SBPweb.Themes.Windows.Skins
{
	/// <summary>
	/// Class of Margin
	/// </summary>
	public class Margin
	{
		private Padding mPadding = new Padding(0, 0, 0, 0);

		/// <summary>
		/// Constructor of Margin
		/// </summary>
		public Margin()
		{
		}

		/// <summary>
		/// Constructor of Margin
		/// </summary>
		/// <param name="padding">padding</param>
		public Margin(Padding padding)
		{
			mPadding = padding;
		}

		/// <summary>
		/// Constructor of Margin
		/// </summary>
		/// <param name="node">xml node</param>
		public Margin(XmlNode node)
		{
			if (node != null)
			{
				XmlAttribute leftAtt = node.Attributes["Left"];
				XmlAttribute rightAtt = node.Attributes["Right"];
				XmlAttribute topAtt = node.Attributes["Top"];
				XmlAttribute bottomAtt = node.Attributes["Bottom"];

				mPadding = new Padding(
					leftAtt != null ? int.Parse(leftAtt.Value) : 0,
					topAtt != null ? int.Parse(topAtt.Value) : 0,
					rightAtt != null ? int.Parse(rightAtt.Value) : 0,
					bottomAtt != null ? int.Parse(bottomAtt.Value) : 0);
			}
		}

		/// <summary>
		/// Padding
		/// </summary>
		public Padding Padding
		{
			get
			{
				return mPadding;
			}
		}

		/// <summary>
		/// All padding
		/// </summary>
		public int All
		{
			get
			{
				return mPadding.All;
			}
		}

		/// <summary>
		/// Bottom padding
		/// </summary>
		public int Bottom
		{
			get
			{
				return mPadding.Bottom;
			}
		}

		/// <summary>
		/// Horizontal padding
		/// </summary>
		public int Horizontal
		{
			get
			{
				return mPadding.Horizontal;
			}
		}

		/// <summary>
		/// Left padding
		/// </summary>
		public int Left
		{
			get
			{
				return mPadding.Left;
			}
		}

		/// <summary>
		/// Right padding
		/// </summary>
		public int Right
		{
			get
			{
				return mPadding.Right;
			}
		}

		/// <summary>
		/// Size
		/// </summary>
		public System.Drawing.Size Size
		{
			get
			{
				return mPadding.Size;
			}
		}

		/// <summary>
		/// Top padding
		/// </summary>
		public int Top
		{
			get
			{
				return mPadding.Top;
			}
		}

		/// <summary>
		/// Vertical padding
		/// </summary>
		public int Vertical
		{
			get
			{
				return mPadding.Vertical;
			}
		}
	}
}
